{php include wl_template('common/header');}
<ul class="nav nav-tabs">
	<li {if $op=='display'}class="active"{/if}><a href="{php echo web_url('member/member/display')}">会员</a></li>
	{if !empty($uid)}
	<li {if $op=='credit_record' && $status==1}class="active"{/if}><a href="{php echo web_url('member/member/credit_record',array('status'=>1,'uid'=>$uid))}">积分</a></li>
	<li {if $op=='credit_record' && $status==2}class="active"{/if}><a href="{php echo web_url('member/member/credit_record',array('status'=>2,'uid'=>$uid))}">余额</a></li>
	{/if}
</ul>
{if $op=='display'}
<div class="panel panel-info">
	<div class="panel-heading">筛选</div>
	<div class="panel-body">
		<form action="./index.php" method="get" class="form-horizontal" role="form" id="form">
			<input type="hidden" name="c" value="site" />
            <input type="hidden" name="a" value="entry" />
            <input type="hidden" name="m" value="lexiangpingou" />
            <input type="hidden" name="do" value="member" />
			<input type="hidden" name="ac" value="member" />
			<input type="hidden" name="op" value="display" />
			<input type="hidden" name="status" value="{$_GPC['status']}">
			<div class="form-group">
				<label class="col-md-2 control-label">关键字类型</label>
				<div class="col-sm-8 col-xs-12">
					<select name="type" class="form-control">
						<option value="2" {if $_GPC['type'] == 2}selected{/if}>手机号</option>
						<option value="4" {if $_GPC['type'] == 4}selected{/if}>真实姓名</option>
						<option value="3" {if $_GPC['type'] == 3}selected{/if}>昵称</option>
					</select>
				</div>
			</div>
			<div class="form-group">
				<label class="col-md-2 control-label">关键字</label>
				<div class="col-md-8">
					<input type="text" class="form-control" name="keyword" id="keyword" value="{$_GPC['keyword']}" />
				</div>
				<div class="pull-right col-md-2">
					<button class="btn btn-default"><i class="fa fa-search"></i> 搜索</button>
				</div>
			</div>
		</form>
	</div>
</div>
<div class="panel panel-default">
	<div class="table-responsive">
		<table class="table table-hover">
			<thead class="navbar-inner">
				<tr>
					<th style="width:80px;"></th>
					<th style="width:110px;">手机</th>
					<th style="width:100px;">真实姓名</th>
					<th style="width:100px;">昵称</th>
					<!--<th style="width:100px;">积分</th>-->
					<th style="width:100px;">上级</th>
					<th style="width:120px;" class="text-center">操作</th>
				</tr>
			</thead>
			<tbody>
			{loop $list $li}

				<tr id="{$li['id']}">
					<td><img src="{if !empty($li['avatar'])}{$li['avatar']}{else}resource/images/noavatar_middle.gif{/if}" width="48"></td>
					<td>{$li['mobile']}</td>
					<td>{$li['realname']}</td>
					<td>{$li['nickname']}</td>
					<!--<td id="credit1{$li['uid']}">{$li['credit1']}</td>-->
					<td id="credit2{$li['uid']}">{$li['pname']}</td>
					<td>
						<a href="javascript:void(0)" uid="{$li['uid']}" class="js-recharge" title="充值">更改上级</a>
					</td>
				</tr>
			{/loop}
			</tbody>
		</table>
	</div>
</div>
{$pager}
<div id="modal-message" class="modal fade compact in" tabindex="-1" role="dialog" aria-hidden="false" style="display: none; padding-right: 17px;">
	<div class="modal-dialog">	<div class="modal-content">
		<div class="modal-header">	<h4>会员操作<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button></h4></div>
		<div class="modal-body">
	<style>
		.row .row{
			margin:0 -15px;
		}
		table tbody tr td{
			width: 20%;
		}
		.table>tbody>tr>td{
			white-space: inherit;
		}
	</style>
<!--<form class="table-responsive" method="post" action="./index.php?c=mc&amp;a=creditmanage&amp;do=manage&amp;" id="form1">-->
	<!--<input type="hidden" name="do" value="manage">-->
	<!--<input type="hidden" name="uid" value="">-->
	<!--<input name="token" type="hidden" value="db754d26">-->
	<!--<table class="table table-hover table-bordered">-->
		<!--<tbody>-->
			<!--<tr>-->
				<!--<th>积分</th>-->
				<!--<td>-->
					<!--<label class="radio-inline"><input type="radio" name="credit1_type" value="1" checked=""> 增加</label>-->
					<!--<label class="radio-inline"><input type="radio" name="credit1_type" value="2"> 减少</label>-->
				<!--</td>-->
				<!--<td>-->
					<!--<input type="text" name="credit1_value" value="0" class="form-control">-->
				<!--</td>-->
			<!--</tr>-->
			<!--<tr>-->
				<!--<th>余额</th>-->
				<!--<td>-->
					<!--<label class="radio-inline"><input type="radio" name="credit2_type" value="1" checked=""> 增加</label>-->
					<!--<label class="radio-inline"><input type="radio" name="credit2_type" value="2"> 减少</label>-->
				<!--</td>-->
				<!--<td>-->
					<!--<input type="text" name="credit2_value" value="0" class="form-control">-->
				<!--</td>-->
			<!--</tr>-->
			<!--<tr>-->
				<!--<th>积分操作备注</th>-->
				<!--<td colspan="3">-->
					<!--<textarea class="form-control" name="remark"></textarea>-->
				<!--</td>-->
			<!--</tr>-->
		<!--</tbody>-->
	<!--</table>-->
<!--</form>-->
		<div class="row">
			<div class="col-lg-12">
				<div class="input-group">
					<input type="text" class="form-control searchMenber" placeholder="请输入粉丝昵称">
					  <span class="input-group-btn">
						<button class="btn btn-default searchHY" type="button" onclick="search_members()">搜索</button>
					  </span>
				</div><!-- /input-group -->
			</div><!-- /.col-lg-6 -->
		</div><!-- /.row -->
	<div class="menbers_body">
	</div>
</div>
		<div class="modal-footer"><a href="#" onclick="closeD()" class="btn btn-default" data-dismiss="modal" aria-hidden="true">关闭</a></div>
	</div></div></div>
<script>
	function search_members() {
		if( $('.searchMenber').val()==''){
			Tip.focus('.searchMenber','请输入关键词');
			return;
		}
		$(".menbers_body").html("正在搜索....");
		$.get("{php echo web_url('store/bdelete/display',array('op'=>'selectsaler'))}", {
			keyword: $('.searchMenber').val()
		}, function(dat){
			$('.menbers_body').html(dat);
		});
	}
	function select_member(o) {
		$.get(
				"{php echo web_url('member/member/update_member')}",
				{
					uid:$('.close').attr('id'),
					parent_id: o.id
				},
				function(data){
					console.log(data);
					$('#'+$('.close').attr('uuid')).html(o.realname+'<br/>'+ o.nickname).attr('id','');
					$(".close").click();
				}
		);
	}
	function closeD(){
		$('#modal-message').hide();
		$('.panel').css("opacity","1");$('.nav').css("opacity","1");$('.pagination').css("opacity","1");
	}
</script>
{elseif $op=='credit_record'}
<div class="well" style="padding: 5px 0 0;">
	<div class="form-horizontal">
		<div class="form-group">
			<label class="col-md-1 control-label">uid</label>
			<div class="col-sm-2">
				<p class="form-control-static">{$member['uid']}</p>
			</div>
			<label class="col-md-1 control-label">昵称</label>
			<div class="col-sm-5">
				<p class="form-control-static">{if $member['nickname']}{$member['nickname']}{else}-{/if}</p>
			</div>
		</div>
		<div class="form-group">
			<label class="col-md-1 control-label">手机</label>
			<div class="col-sm-2">
				<p class="form-control-static">{if $member['mobile']}{$member['mobile']}{else}-{/if}</p>
			</div>
			<label class="col-md-1 control-label">姓名</label>
			<div class="col-sm-5">
				<p class="form-control-static">{if $member['realname']}{$member['realname']}{else}-{/if}</p>
			</div>
		</div>
	</div>
</div>
<style>
	table thead tr th {text-align: center;}
	table tbody tr td {text-align: center; height: 50px;}
	table tbody tr td:last-child {text-align: center;}
</style>
<div class="panel panel-default">
	<div class=" panel-body table-responsive">
		<table class="table table-hover">
			<thead>
				<tr>
					<th style="width:20%;">类型</th>
					<th style="width:20%;">数目</th>
					<th style="width:20%;">操作时间</th>
					<th style="width:30%;">备注</th>
				</tr>
			</thead>
			<tbody>
				{loop $credits_records $row}
					<tr>
						<td>{if $row['table']==1}乐享拼购{else}拼团{/if}</td>
						<td>{$row['num']}</td>
						<td>{php echo date('Y-m-d H:i:s', $row['createtime'])}</td>	
						<td>{$row['remark']}</td>
					</tr>
				{/loop}
			</tbody>
		</table>
	</div>
</div>
{$pager}
{/if}
<script>
	$(function(){
		$('.js-recharge').click(function() {
			var uid = $(this).attr('uid');
			if(uid==''){util.tips("非关注会员不能充值!!");return false;}
			$('#submit').attr("uid",uid);
			$('.close').attr("uuid",$(this).parent().prev().attr('id')).attr('id',$(this).parent().parent().attr('id'));
			$('#modal-message').show();
			$('.panel').css("opacity","0.2");$('.nav').css("opacity","0.2");$('.pagination').css("opacity","0.2");
		});
		$('.close').click(function() {
			$('#modal-message').hide();
			$('.panel').css("opacity","1");$('.nav').css("opacity","1");$('.pagination').css("opacity","1");
		});
		$('#submit').click(function() {
			var uid = $(this).attr('uid');
			var credit1_type = $("input[name='credit1_type']:checked").val();
			var credit1_value = $("input[name='credit1_value']").val();
			var credit2_type = $("input[name='credit2_type']:checked").val();
			var credit2_value = $("input[name='credit2_value']").val();
			var remark = $("textarea[name='remark']").val();
			$.post("{php echo web_url('member/member/modal')}",{remark:remark,uid:uid,credit1_type:credit1_type,credit1_value:credit1_value,credit2_type:credit2_type,credit2_value:credit2_value},function(d){
				if(!d.errno){
					$('#credit1'+uid).html(d.credit1);
					$('#credit2'+uid).html(d.credit2);
				}
				util.tips(d.message);
			},"json");
			$('#modal-message').hide();
			$('.panel').css("opacity","1");$('.nav').css("opacity","1");$('.pagination').css("opacity","1");
		});
		
	});


</script>
{php include wl_template('common/footer');}
